1. /* simstdbl.cpp by K.Tsuru */
  2. // function ID = 401 BRADIX
  3. #ifndef SN_H
  4. #include "sn.h"
  5. #endif
  6. /**************************
  7. SInteger class
  8. It sets a double value "d".
  9. ***************************/
  10. void SInteger::SetIDouble(double d){
  11. double x = fabs(d);
  12. if(x < (double)BRADIX_SQ ){ //under two figures
  13. SetZero(); //including memory allocation
  14. if(x < 1.0) return;
  15. ulong L = (ulong)x;
  16. if(L < (ulong)BRADIX){ //less than BRADIX
  17. figure[0] = (fType)L; // aHead = aTail = 0
  18. } else { // x < (double)BRADIX_SQ
  19. if( (figure[0] = fType(L%BRADIX)) == 0 ) aTail = 1u;
  20. figure[1] = fType(L/BRADIX); aHead = 1u;
  21. }
  22. SetSign(d); return;
  23. }
  24. SLong a(d);
  25. *this = ConvToBin(a);
  26. }

simstdbl.cpp : last modifiled at 2017/03/13 14:32:00(715 bytes)
created at 2016/04/25 14:53:17
The creation time of this html file is 2017/10/25 11:09:45 (Wed Oct 25 11:09:45 2017).